import request from "@/utils/request";
import { queryString } from "@/utils/url";

/**
 * 分页列表
 * @param { listPageParams } params
 * @param { listPageData } data
 * @return { engineeringlistData }
 */
export const engineeringPageList = (params, data) => {
  return request({
    url: `/crm/build/pageList?${queryString(params)}`,
    method: "post",
    data
  });
};

/**
 * 分组列表
 * @return { groupListItem[] }
 */
export const groupList = () => {
  return request({
    url: "/crm/build/groupList",
    method: "post"
  });
};

/**
 * 收款统计
 */
export const receiveStatistics = () => {
  return request({
    url: "/crm/build/receive/statistics",
    method: "get"
  });
};

/**
 * 获取当前用户的责任人配置
 */
export const responsibleConfig = () => {
  return request({
    url: "/crm/build/detail",
    method: "get"
  });
};

/**
 * 设置当前用户的责任人配置
 */
export const responsibleConfigSet = data => {
  return request({
    url: "/crm/build/setPrincipal",
    method: "post",
    data
  });
};

/**
 * 根据客户id查询任务
 * @param customerId
 * @return {*}
 */
export const taskListByCustomerId = customerId => {
  return request({
    url: `/crm/build/task/TrackTask/${customerId}`,
    method: "get"
  });
};

/**
 * 验收计划列表
 * @param { string } customerId -客户ID
 * @param modelId
 */
export const getAcceptanceList = (customerId, modelId) => {
  return request({
    url: `/crm/checkStandard/businessList/${customerId}`,
    method: "get",
    params: {
      modelId
    }
  });
};
/**
 *开工确认详情信息
 */

export const workConfirmDetail = customerId => {
  return request({
    url: `/crm/build/start/${customerId}`,
    method: "get"
  });
};
/**
 * 开工确认
 * data:提交参数
 */
export const startWorkConfirm = data => {
  return request({
    url: "/crm/build/start/confirm",
    method: "post",
    data
  });
};
/**
 * 开工停工
 */
export const operateWork = data => {
  return request({
    url: "/crm/build/operate",
    method: "post",
    data
  });
};
/**
 * 客户基本信息 + 跟进记录
 * @param { string } customerId
 */
export const clientInfoAndFollow = customerId => {
  return request({
    url: `/crm/info/getInfoPenetration/${customerId}`,
    method: "get"
  });
};
/**
 * 设置重点客户+添加重点关注事项
 * data:提交参数
 */
export const setKeyCustomer = data => {
  return request({
    url: "/crm/build/customer/setKey",
    method: "post",
    data
  });
};
/**
 * 获取重点关注事项
 */
export const getAttentionMatter = customerId => {
  return request({
    url: `/crm/build/customer/hover/${customerId}`,
    method: "get"
  });
};
/**
 * 取消关注
 */
export const cancelAttention = customerId => {
  return request({
    url: `/crm/build/customer/cancel/${customerId}`,
    method: "get"
  });
};

/**
 * 重置客户
 */
export const resetClientInfo = customerId => {
  return request({
    url: `/crm/build/task/resetTask/${customerId}`,
    method: "get",
    overtime: "20000"
  });
};

/**
 * 获取跟进记录
 */
export const followLogByCustomerId = customerId => {
  return request({
    url: `/crm/build/track/trackListPc/${customerId}`,
    method: "get"
  });
};

/**
 * 新增跟进
 */
export const addFollowLog = data => {
  return request({
    url: "/crm/build/track/add",
    method: "post",
    data
  });
};
/**
 * 完工日期
 */
export const completionDate = (customerId, params) => {
  return request({
    url: `/crm/build/getContractPlainEndDate/${customerId}`,
    method: "get",
    params
  });
};

/**
 * 导出
 */
export const exportExcel = data => {
  return request({
    url: "/crm/build/export",
    method: "post",
    data
  });
};
